package com.medicine.product.study.factory;

/**
 * @author lynn
 * @version 1.0
 * @date 2022/2/14
 */
public class SendFactory {

    //普通工厂模式
    public Sender produce(String type) {
        if ("mail".equals(type)) {
            return new MailSender();
        } else if ("sms".equals(type)) {
            return new SmsSender();
        } else {
            System.out.println("Please input right type!");
        }
        return null;
    }

    //工厂方法模式
    public Sender produceMail(){
        return new MailSender();
    }

    public Sender produceSms(){
        return new SmsSender();
    }
}
